﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cinchoo.Core.Configuration;
using Cinchoo.Core.Xml.Serialization;
using Cinchoo.Core;
using Cinchoo.Core.Diagnostics;
using System.Threading.Tasks;

namespace ChoWorkflowServer
{
    [ChoConfigurationSection("connectionManagerSettings")]
    public class ChoConnectionManagerSettings : ChoConfigurableObject
    {
        [ChoPropertyInfo("serverConnectPlugIns")]
        public ChoCDATA OnServerConnectPlugIns;

        [ChoPropertyInfo("serverDisconnectPlugIns")]
        public ChoCDATA OnServerDisconnectPlugIns;

        //[ChoIgnoreProperty]
        //internal readonly ChoPlugIns<string> OnServerConnectPlugInsObjs = new ChoPlugIns<string>();

        //[ChoIgnoreProperty]
        //internal readonly ChoPlugIns<string> OnServerDisconnectPlugInsObjs = new ChoPlugIns<string>();

        protected override void OnAfterConfigurationObjectLoaded()
        {
            //if (OnServerConnectPlugIns != null && !OnServerConnectPlugIns.Value.IsNullOrWhiteSpace())
            //{
            //    OnServerConnectPlugInsObjs.Load(OnServerConnectPlugIns.Value);
            //}
            //if (OnServerDisconnectPlugIns != null && !OnServerDisconnectPlugIns.Value.IsNullOrWhiteSpace())
            //{
            //    OnServerDisconnectPlugInsObjs.Load(OnServerConnectPlugIns.Value);
            //}
        }

        internal void InvokeOnServerConnectPlugIns(string hostName)
        {
            //OnServerConnectPlugInsObjs.InvokeAsync(hostName);
        }

        internal void InvokeOnServerDisconnectPlugIns(string hostName)
        {
            //OnServerDisconnectPlugInsObjs.InvokeAsync(hostName);
        }
    }
}
